$(document).ready(function(){
    rd.showdetails('开始采集...');
    rd.done();
});

var rd = {};

(function(r){
    r.tp = 1;
    r.p = 1;
    r.fp = 0;

    r.done = function(){
        if(urllist.length>0){
            r.tp = urllist.length;
            r.showinfo();
            r.pick(urllist[r.p-1]);
        }
    };

    r.pick = function(url){
        $.post('/a/pick/done/'+kn+'/',
                {'url':url},
                function(data){
                    r.showdetails(data.msg);
                    if(data.status == false)
                        r.fp++;
                    r.showinfo();
                    r.p++;
                    r.pick(urllist[r.p-1]);
                },
               'json'
        );
    };

    r.showdetails = function(msg){
        $('.pick_info_details').html($('.pick_info_details').html() + '<br/>' + msg);
    };

    r.showinfo = function(){
        $('#pick_page').html(r.p);
        $('#pick_pages').html(r.tp);
        $('#pick_page_faild').html(r.fp);
    };
})(rd);